<?php
// The applications root path, so we can easily get this path from files located in other folders
define ( "PROJ_ROOT", "./" );

require_once (PROJ_ROOT . 'include/GzoolSmarty.class.php');
require_once (PROJ_ROOT . 'include/functions.php');
require_once (PROJ_ROOT . 'configs/config.php');
require_once (PROJ_ROOT . 'include/Database.class.php');

/**
 * @todo: global variables
 */
$template = new GzoolSmarty ( );
// create a database connection
$db = new Database ( $config ['dbServer'], $config ['dbUser'], $config ['dbPass'], $config ['dbName'], $config ['tablePrefix'] );
$db->connect ();

/**
 * @todo: switch language
 */
$langName = selectLanguage ();

if (file_exists ( PROJ_ROOT . 'language/' . $langName . '/common.php' )) {
    include (PROJ_ROOT . 'language/' . $langName . '/common.php');
} else {
    include (PROJ_ROOT . 'language/en/common.php');
}

$template->assign ( array ('rootpath' => $template->template_dir ) );
?>